package com.river.boot.biz.converter;

import org.mapstruct.Mapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.river.boot.biz.model.entity.Product;
import com.river.boot.biz.model.form.ProductForm;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

/**
 * 菜品对象转换器
 *
 * @author JiangCheng Xiang
 * @since 2025-04-24 21:04
 */
@Mapper(componentModel = "spring")
public interface ProductConverter {

    @Mappings({
            @Mapping(target = "tags", ignore = true),
            @Mapping(target = "imageList", ignore = true),
    })
    ProductForm toForm(Product entity);

    @Mappings({
            @Mapping(target = "tags", ignore = true),
            @Mapping(target = "imageList", ignore = true),
    })
    Product toEntity(ProductForm formData);
}